// workflow definition
Workflow.extend ({    
    /**
     * 创建 Process
     */
    setCreateProcess: function(workflowName) {
        $("#WorkflowName").val(workflowName);
        $("#ProcActionCnt").html("<a href='javascript:' onclick='Workflow.createProcess();'>开始</a> ");
        $("#ProcActionCnt").append("<a href='javascript:' onclick='Workflow.createProcessCancle();'>取消</a>");
        setHideShow("WorkflowContents");
    },
    createProcess: function() {
        //
        var workflowName = $('#WorkflowName').val();
        var workflowContent = $('#WorkflowContent').val();
        var params = {act:"createProcess", tc: workflowContent, wf: workflowName};
        //
        this.Ajax_Response = "createProcessResponse";
        this.ajaxAction(params);
    },
    createProcessCancle: function() {
        setHideShow(Workflow.Current_View);
    },
    createProcessResponse: function(xmlData) {
        //var xmlDoc = parseXML(xmlData);
        alert(xmlData);
    }
});


/*
 * 设置工作流定义
 */
Workflow.extend ({
    setListWorkflow: function() {        
        var tb = new SysTable();
        var header = [
            {label:'流程名称', width:100},
            {label:'描述'},
            {label:'版本', width:50},
            {label:'新流程', width: 50, type: "link", align: 'center'},
            {label:'任务', width: 50, type: "link", align: 'center'},
            {label:'图例', width: 50, type: "link", align: 'center'}
        ];
        var tbConfig = {url: '../stringRes?s=workflowAction&act=listWorkflowDefs', 
            width: 600, height: 200};
        tb.init("WorkflowsTableDiv", header, tbConfig);
    }
});


/*
 * 上传工作流定义
 * workflow definition upload
 */
function workflowDefUploadCallback(result) {
    alert(result);
    $("#WorkflowDefUploadMessage").html(result);
}
            
function workflowDefUploadSend() {
    $("#WorkflowUploadForm").submit();
}
            
function workflowDefUploadCancle() {
    alert($("#hidden_frame").html());
}